﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MarvellousWorks.PracticalPattern.FactoryMethod.Batch
{
    public class Client
    {
        // 实际项目中，可以通过 Assembler 从外部把 Director 注入
        private DirectorBase _director = new ProductDirector();
        public IProduct[] Products()
        {
            ProductCollection collection = new ProductCollection();
            foreach (var decision in _director.Decisions)
            {
                collection += decision.Factory.Create(decision.Quantity);
            }
            return collection.Data;
        }
    }
}
